package com.ksyun.start.camp.controller;

import com.ksyun.start.camp.model.ApiResponse;
import com.ksyun.start.camp.model.ResponseFromTime;
import com.ksyun.start.camp.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 默认的客户端 API Controller
 */
@RestController
public class ClientController {
    // 在这里开始编写你的相关接口实现代码
    // 提示：调用 ClientService
    @Autowired
    ClientService clientService;

    @GetMapping("/api/getInfo")
    public ApiResponse<ResponseFromTime> getInfo(@RequestParam(required = false) String style) {
        // 调用 ClientService 中的方法获取客户端信息
        if (StringUtils.isEmpty(style)){//默认使用full
            return clientService.getInfo("full");
        }
        return clientService.getInfo(style);
    }
}
